def month_before_wont_use(given_date)
    date_tmp = given_date.to_s.split(' ')
    date = date_tmp[0].split('-')
      if date[1].to_i > 12 or date[2].to_i > 31
          puts "Invalid date."
          exit
      end
      if date[2].to_i >= 28
          "#{date[0]}-#{date[1]}-#{date[2].to_i-28}"
      elsif date[2].to_i < 28 and date[1].to_i > 1
          "#{date[0]}-#{date[1].to_i-1}-#{date[2].to_i+3}"
      else date[2].to_i < 28 and date[1].to_i == 1
          "#{date[0].to_i-1}-12-#{date[2].to_i+3}"
      end

end

def get_date(a_time_string)
	a_time_string.to_s.split(/ \d{2}.*$/)[0]
end

def month_before(a_date)
	a_date - 28 * 24 * 60 *60
end
